<?php



class EMS
{

	function data($data)
	{
		$pattern = "((0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/]((19|20)\d\d))";  
		if (preg_match($pattern, $data, $matches)) {

			return $matches[2]."/".$matches[1]."/".$matches[3];
		}

		//throw new Exception("Erro de Formatação de Data", 1);
		

	}

	function dataBanco($data)
	{
		$pattern = "((0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/]((19|20)\d\d))";  
		if (preg_match($pattern, $data, $matches)) {

			return $matches[2]."/".$matches[1]."/".$matches[3];
		}

		//throw new Exception("Erro de Formatação de Data", 1);
		

	}	

}